/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.bear.fe.conn2;
import java.io.File;
import java.util.*;
/**
 *
 * @author libear
 */
public class VFileTable {
    Map<String,VFile> map = Collections.synchronizedMap(new HashMap<String,VFile>());
   FileSystemUtility util = new FileSystemUtility();
   static VFileTable table = new VFileTable();
    public synchronized VFile getVFile(String path){
        VFile file = map.get(path);
        if(file==null){
            file = new VFile(path);
            file.setTable(this); 
            file.setPersistStatus(util.isExist(path)?1:0);
            map.put(path, file);
        }
        return file;        
    }
    
   public static VFileTable instance() {
       return table ;
   }
    
//    public void putDeletedFiles(String sessionId,String deletedFile,String filePath){
//        long start = Long.parseLong(sessionId.split("_")[0]);
//        List list = deletes.get(deletedFile);
//        if()
//    }
    public synchronized VFile isExist(String path){
        path = path.replace(File.separator, "/");
        VFile file = map.get(path);
        return file;
    }
   
    
    
}
